home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / ietf / urn / urn-archives / urn-ietf.archive.9701 / 000001_owner-urn-ietf _Wed Jan 8 18:15:57 1997.msg < prev    next >
Internet Message Format  |  1997-02-19  |  43KB

  1. Received: (from daemon@localhost) by services.bunyip.com (8.6.10/8.6.9) id SAA29526 for urn-ietf-out; Wed, 8 Jan 1997 18:15:57 -0500
  2. Received: from mocha.bunyip.com (mocha.Bunyip.Com [192.197.208.1]) by services.bunyip.com (8.6.10/8.6.9) with SMTP id SAA29521 for <urn-ietf@services.bunyip.com>; Wed, 8 Jan 1997 18:15:48 -0500
  3. Received: from acl.lanl.gov by mocha.bunyip.com with SMTP (5.65a/IDA-1.4.2b/CC-Guru-2b)
  4.         id AA28848  (mail destined for urn-ietf@services.bunyip.com); Wed, 8 Jan 97 18:15:28 -0500
  5. Received: from legiron.acl.lanl.gov (legiron.acl.lanl.gov [128.165.147.188]) by acl.lanl.gov (8.7.3/8.7.3) with SMTP id QAA03290 for <urn-ietf@bunyip.com>; Wed, 8 Jan 1997 16:15:09 -0700 (MST)
  6. Message-Id: <3.0.32.19970108162501.006e2590@acl.lanl.gov>
  7. X-Sender: rdaniel@acl.lanl.gov
  8. X-Mailer: Windows Eudora Pro Version 3.0 (32)
  9. Date: Wed, 08 Jan 1997 16:25:21 -0700
  10. To: urn-ietf@bunyip.com
  11. From: "Ron Daniel Jr." <rdaniel@lanl.gov>
  12. Subject: [URN] NAPTR draft - version 2
  13. Mime-Version: 1.0
  14. Content-Type: text/plain; charset="us-ascii"
  15. Sender: owner-urn-ietf@services.bunyip.com
  16. Precedence: bulk
  17. Reply-To: "Ron Daniel Jr." <rdaniel@lanl.gov>
  18. Errors-To: owner-urn-ietf@bunyip.com
  19.  
  20. Hi,
  21.  
  22. Here is the NAPTR draft, with edits to incorporate the comments from
  23. the San Jose meeting. There are two references that need to be
  24. cleaned up, other than that I think it is ready to go. Your comments
  25. please!
  26.  
  27. Regards,
  28. Ron
  29. ===========
  30.  
  31.  
  32.  
  33. INTERNET DRAFT                                                  Ron Daniel
  34. draft-ietf-urn-naptr-02.txt                 Los Alamos National Laboratory
  35.                                                           Michael Mealling
  36.                                                    Network Solutions, Inc.
  37.                                                              08 Jan., 1996
  38.  
  39.  
  40.                 Resolution of Uniform Resource Identifiers
  41.                        using the Domain Name System
  42.  
  43.  
  44. Status of this Memo
  45. ===================
  46.  
  47.     This document is an Internet-Draft.  Internet-Drafts are working
  48.     documents of the Internet Engineering Task Force (IETF), its
  49.     areas, and its working groups.  Note that other groups may also
  50.     distribute working documents as Internet-Drafts.
  51.   
  52.     Internet-Drafts are draft documents valid for a maximum of six
  53.     months and may be updated, replaced, or obsoleted by other
  54.     documents at any time.  It is inappropriate to use Internet-
  55.     Drafts as reference material or to cite them other than as
  56.     ``work in progress.''
  57.   
  58.     To learn the current status of any Internet-Draft, please check
  59.     the ``1id-abstracts.txt'' listing contained in the Internet-
  60.     Drafts Shadow Directories on ftp.is.co.za (Africa),
  61.     nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  62.     ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  63.  
  64.     This draft expires 14 July, 1997.
  65.   
  66.   
  67. Abstract:
  68. =========
  69.  
  70. Uniform Resource Locators (URLs) are the foundation of the World Wide
  71. Web, and are a vital Internet technology. However, they have proven to
  72. be brittle in practice. The basic problem is that URLs typically
  73. identify a particular path to a file on a particular host. There is no
  74. graceful way of changing the path or host once the URL has been
  75. assigned. Neither is there a graceful way of replicating the resource
  76. located by the URL to achieve better network utilization and/or fault
  77. tolerance. Uniform Resource Names (URNs) have been hypothesized as a
  78. adjunct to URLs that would overcome such problems. URNs and URLs
  79. are both instances of a broader class of identifiers known as Uniform
  80. Resource Identifiers (URIs).
  81.  
  82. This document describes a new DNS Resource Record, NAPTR (Naming
  83. Authority PoinTeR), that provides rules for mapping parts of URIs to
  84. domain names.  By changing the mapping rules, we can change the host
  85. that is contacted to resolve a URI. This will allow a more graceful
  86. handling of URLs over long time periods, and forms the foundation for a
  87. new proposal for Uniform Resource Names.
  88.  
  89. In addition to locating resolvers, the NAPTR provides for other naming
  90. systems to be grandfathered into the URN world, provides independence
  91. between the name assignment system and the resolution protocol system,
  92. and allows multiple services (Name to Location, Name to Description,
  93. Name to Resource, ...) to be offered.  In conjunction with the SRV RR,
  94. the NAPTR record allows those services to be replicated for the purposes
  95. of fault tolerance and load balancing.
  96.  
  97.  
  98. Introduction:
  99. =============
  100.  
  101. Uniform Resource Locators have been a significant advance in locating
  102. resources on the Internet. However, their  brittle nature over time
  103. has been recognized for several years. The Uniform Resource Identifier
  104. working group proposed the development of Uniform Resource Names to serve
  105. as persistent, location-independent identifiers for Internet resources
  106. in order to overcome most of the problems with URLs. RFC-1737 [1] sets
  107. forth requirements on URNs.
  108.  
  109. During the lifetime of the URI-WG, a number of URN proposals were
  110. generated. The developers of several of those proposals met in a series
  111. of meetings, resulting in a compromise known as the Knoxville framework.
  112. The major principle behind the Knoxville framework is that the resolution
  113. system must be separate from the way names are assigned. This is in
  114. marked contrast to most URLs, which identify the host to contact and
  115. the protocol to use. Readers are referred to [2] for background on the
  116. Knoxville framework and for additional information on the context and
  117. purpose of this proposal.
  118.  
  119. Separating the way names are resolved from the way they are constructed
  120. provides several benefits. It allows multiple naming approaches and
  121. resolution approaches to compete, as it allows different protocols and
  122. resolvers to be used. There is just one problem with such a separation -
  123. how do we resolve a name when it can't give us directions to its
  124. resolver?
  125.  
  126. For the short term, DNS is the obvious candidate for the resolution
  127. framework, since it is widely deployed and understood. However, it is
  128. not appropriate to use DNS to maintain information on a per-resource
  129. basis. First of all, DNS was never intended to handle that many
  130. records. Second, the limited record size is inappropriate for catalog
  131. information. Third, domain names are not appropriate as URNs.
  132.  
  133. Therefore our approach is to use DNS to locate "resolvers" that can
  134. provide information on individual resources, potentially including the
  135. resource itself. To accomplish this, we "rewrite" the URI into a domain
  136. name following the rules provided in NAPTR records. Rewrite rules
  137. provide considerable power, which is important when trying to meet the
  138. goals listed above. However, collections of rules can become difficult
  139. to understand. To lessen this problem, the NAPTR rules are *always*
  140. applied to the original URI, *never* to the output of previous rules.
  141.  
  142. Locating a resolver through the rewrite procedure may take multiple
  143. steps, but the beginning is always the same. Every URI has a
  144. colon-delimited prefix.  NAPTR resolution begins by taking this prefix,
  145. appending the well-known suffix ".urn.net", and querying the DNS for NAPTR
  146. records at that domain name.  Based on the results of this query, zero
  147. or more additional DNS queries may be needed to locate resolvers for the
  148. URI. The details of the conversation between the client and the resolver
  149. thus located are outside the bounds of this draft. Three brief examples of
  150. this procedure are given in the next section.
  151.  
  152. The NAPTR RR provides the level of indirection needed to keep the naming
  153. system independent of the resolution system, its protocols, and services.
  154. Coupled with the new SRV resource record proposal[3] there is also the
  155. potential for replicating the resolver on multiple hosts, overcoming some
  156. of the most significant problems of URLs. This is an important and subtle
  157. point. Not only do the NAPTR and SRV records allow us to replicate
  158. the resource, we can replicate the resolvers that know about the replicated
  159. resource. Preventing a single point of failure at the resolver level
  160. is a significant benefit. Separating the resolution procedure from the
  161. way names are constructed has additional benefits. Different resolution
  162. procedures can be used over time, and resolution procedures that are
  163. determined to be useful can be extended to deal with additional namespaces.
  164.  
  165. Caveats
  166. =======
  167.  
  168. The NAPTR proposal is the first resolution procedure to be considered by the
  169. URN-WG. There are several concerns about the proposal which have motivated
  170. the group to recommend it for publication as an Experimental rather than a
  171. standards-track RFC.
  172.  
  173. First, URN resolution is new to the IETF and we wish to gain operational
  174. experience before recommending any procedure for the standards track. Second,
  175. the NAPTR proposal is based on DNS and consequently inherits concerns about
  176. security and administration. The recent advancement of the DNSSEC and secure
  177. update drafts to Proposed Standard reduce these concerns, but we wish to
  178. experiment with those new capabilities in the context of URN administration.
  179. A third area of concern is the potential for a noticeable impact on the DNS.
  180. We believe that the proposal makes appropriate use of caching and additional
  181. information, but it is best to go slow where the potential for impact on a
  182. core system like the DNS is concerned. Fourth, the rewrite rules in the NAPTR
  183. proposal are based on regular expressions. Since regular expressions are
  184. difficult for humans to construct correctly, concerns exist about the
  185. usability and maintainability of the rules. This is especially true where
  186. international character sets are concerned.
  187.  
  188. Terminology
  189. ===========
  190.  
  191. "Must" or "Shall" - Software that does not behave in the manner that this
  192.            document says it must is not conformant to this document.
  193. "Should" - Software that does not follow the behavior that this document
  194.            says it should may still be conformant, but is probably broken
  195.            in some fundamental way.
  196. "May" -    Implementations may or may not provide the described behavior,
  197.            while still remaining conformant to this document.
  198.  
  199.  
  200. Brief overview and examples of the NAPTR RR:
  201. ============================================
  202.  
  203. A detailed description of the NAPTR RR will be given later, but to give
  204. a flavor for the proposal we first give a simple description of the
  205. record and three examples of its use.
  206.  
  207. The key fields in the NAPTR RR are order, preference, service, flags,
  208. regexp, and replacement:
  209. * The order field specifies the order in which records MUST be processed
  210.   when multiple NAPTR records are returned in response to a single query.
  211.   A naming authority may have delegated a portion of its namespace to
  212.   another agency. Evaluating the NAPTR records in the correct order is
  213.   necessary for delegation to work properly.
  214. * The preference field specifies the order in which records SHOULD
  215.   be processed when multiple NAPTR records have the same value of "order".
  216.   This field lets a service provider specify the order in which resolvers
  217.   are contacted, so that more capable machines are contacted in preference
  218.   to less capable ones.
  219. * The service field specifies the resolution protocol and resolution
  220.   service(s) that will be available if the rewrite specified by the
  221.   regexp or replacement fields is applied. Resolution protocols are
  222.   the protocols used to talk with a resolver. They will be specified in
  223.   other documents, such as [4]. Resolution services are operations such as
  224.   N2R (URN to Resource), N2L (URN to URL), N2C (URN to URC), etc.
  225.   These will be discussed in the URN Resolution Services document[5], and
  226.   their behavior in a particular resolution protocol will be given in
  227.   the specification for that protocol (see [4] for a concrete example).
  228. * The flags field contains modifiers that affect what happens in the
  229.   next DNS lookup, typically for optimizing the process. Flags may also
  230.   affect the interpretation of the other fields in the record, therefore,
  231.   clients MUST skip NAPTR records which contain an unknown flag value.
  232. * The regexp field is one of two fields used for the rewrite rules, and is
  233.   the core concept of the NAPTR record. The regexp field is a String
  234.   containing a sed-like substitution expression. (The actual grammar for
  235.   the substitution expressions is given later in this draft). The
  236.   substitution expression is applied to the original URN to determine the
  237.   next domain name to be queried. The regexp field should be used when the
  238.   domain name to be generated is conditional on information in the URI. If
  239.   the next domain name is always known, which is anticipated to be a common
  240.   occurrence, the replacement field should be used instead.
  241. * The replacement field is the other field that may be used for the rewrite
  242.   rule. It is an optimization of the rewrite process for the case where the
  243.   next domain name is fixed instead of being conditional on the content of
  244.   the URI. The replacement field is a domain name (subject to compression if
  245.   a DNS sender knows that a given recipient is able to decompress names in
  246.   this RR type's RDATA field). If the rewrite is more complex than a simple
  247.   substitution of a domain name, the replacement field should be set to . and
  248.   the regexp field used. 
  249.  
  250. Note that the client applies all the substitutions and performs all lookups,
  251. they are not performed in the DNS servers. Note also that it is the belief
  252. of the developers of this document that regexps should rarely be used. The
  253. replacement field seems adequate for the vast majority of situations. Regexps
  254. are only necessary when portions of a namespace are to be delegated to
  255. different resolvers. Finally, note that the regexp and replacement fields are,
  256. at present, mutually exclusive. However, developers of client software should 
  257. be aware that a new flag might be defined which requires values in both fields.
  258.  
  259.  
  260. Example 1
  261. ---------
  262.  
  263. Consider a URN that uses the hypothetical DUNS namespace. DUNS numbers are
  264. identifiers for approximately 30 million registered businesses around
  265. the world, assigned and maintained by Dunn and Bradstreet. The URN
  266. might look like:
  267.  
  268.                  urn:duns:002372413:annual-report-1997
  269.  
  270. The first step in the resolution process is to find out about the DUNS
  271. namespace. The namespace identifier, duns, is extracted from the URN,
  272. prepended to urn.net, and the NAPTRs for duns.urn.net looked up. It might
  273. return records of the form:
  274.  
  275. duns.urn.net
  276. ;;      order pref flags service          regexp        replacement
  277.  IN NAPTR 100  10  "s"  "dunslink+N2L+N2C"  ""   dunslink.udp.isi.dandb.com
  278.  IN NAPTR 100  20  "s"  "rcds+N2C"          ""   rcds.udp.isi.dandb.com
  279.  IN NAPTR 100  30  "s"  "http+N2L+N2C+N2R"  ""   http.tcp.isi.dandb.com
  280.  
  281. The order field contains equal values, indicating that no name delegation
  282. order has to be followed. The preference field indicates that the provider
  283. would like clients to use the special dunslink protocol, followed by
  284. the RCDS protocol, and that HTTP is offered as a last resort. All the
  285. records specify the "s" flag, which will be explained momentarily.
  286. The service fields say that if we speak dunslink, we will be able to
  287. issue either the N2L or N2C requests to obtain a URL or a URC (description)
  288. of the resource. The Resource Cataloging and Distribution Service (RCDS)[6]
  289. could be used to get a URC for the resource, while HTTP could be used to get
  290. a URL, URC, or the resource itself.  All the records supply the next
  291. domain name to query, none of them need to be rewritten with the aid of
  292. regular expressions.
  293.  
  294. The general case might require multiple NAPTR rewrites to locate a
  295. resolver, but eventually we will come to the "terminal NAPTR". Once we
  296. have the terminal NAPTR, our next probe into the DNS will be for a SRV 
  297. or A record instead of another NAPTR. Rather than probing for a non-existent
  298. NAPTR record to terminate the loop, the flags field is used to indicate
  299. a terminal lookup. If it has a value of "s", the next lookup should
  300. be for SRV RRs, "a" denotes that A records should sought. A "p" flag is
  301. also provided to indicate that the next action is Protocol-specific, but
  302. that looking up another NAPTR will not be part of it.
  303.  
  304. Since our example RR specified the "s" flag, it was terminal. Assuming our
  305. client does not know the dunslink protocol, our next action is to lookup SRV
  306. RRs for rcds.udp.isi.dandb.com, which will tell us hosts that can provide
  307. the necessary resolution service. That lookup might return:
  308.  
  309.  ;;                          Pref Weight Port Target
  310.  rcds.udp.isi.dandb.com IN SRV 0    0    1000 defduns.isi.dandb.com
  311.                         IN SRV 0    0    1000 dbmirror.com.au
  312.                         IN SRV 0    0    1000 ukmirror.com.uk
  313.  
  314. telling us three hosts that could actually do the resolution, and
  315. giving us the port we should use to talk to their RCDS server.
  316. (The reader is referred to the SRV proposal [3] for the interpretation
  317. of the fields above).
  318.  
  319. There is opportunity for significant optimization here. We can return the SRV
  320. records as additional information for terminal NAPTRs (and the A records as
  321. additional information for those SRVs). While this recursive provision of
  322. additional information is not explicitly blessed in the DNS specifications, it
  323. is not forbidden, and BIND does take advantage of it [7]. This is a significant
  324. optimization. In conjunction with a long TTL for *.urn.net records, the average
  325. number of probes to DNS for resolving DUNS URNs would approach one. Therefore,
  326. DNS server implementors SHOULD provide additional information with NAPTR
  327. responses. The additional information will be either SRV or A records. If SRV
  328. records are available, their A records should be provided as recursive
  329. additional information.
  330.  
  331. Note that the example NAPTR records above are intended to represent the
  332. reply the client will see. They are not quite identical to what the
  333. domain administrator would put into the zone files. For one thing, the
  334. administrator should supply the trailing '.' character on replacement
  335. domain names. An additional difference will be illustrated later.
  336.  
  337.  
  338. Example 2 
  339. ---------
  340.  
  341. Consider a URN namespace based on MIME Content-Ids. The URN might look
  342. like this:
  343.   
  344.         urn:cid:199606121851.1@mordred.gatech.edu
  345.   
  346. The first step in the resolution process is to find out about the CID
  347. namespace. The namespace identifier, cid, is extracted from the URN,
  348. prepended to urn.net, and the NAPTR for cid.urn.net looked up. It might
  349. return records of the form:
  350.  
  351.  cid.urn.net
  352.   ;;       order pref flags service        regexp           replacement
  353.    IN NAPTR 100   10   ""     ""  "/urn:cid:.+@([^@]+)$/\1/i"    .
  354.  
  355. We have only one NAPTR response, so ordering the responses is not
  356. a problem.  The replacement field is empty, so we check the regexp
  357. field and use the pattern provided there. We apply that regexp to the
  358. entire URN to see if it matches, which it does.  The \1 part of the
  359. substitution expression returns the string "mordred.gatech.edu". Since
  360. the flags field does not contain "s" or "a", the lookup is not terminal
  361. and our next probe to DNS is for more NAPTR records: lookup(query=NAPTR,
  362. "mordred.gatech.edu").
  363.  
  364. While mordred could have its very own NAPTR, maintaining those records
  365. on all the machines at a site as large as Georgia Tech would be an
  366. intolerable burden. Instead, a wildcard may be used so that the domain
  367. administrator at Georgia Tech has only a single NAPTR record to
  368. maintain. That record might look like:
  369.  
  370. *.gatech.edu IN NAPTR
  371. ;;       order pref flags service           regexp  replacement
  372.   IN NAPTR 100  50  "s"  "z3950+N2L+N2C"     ""    z3950.tcp.gatech.edu.
  373.   IN NAPTR 100  50  "s"  "rcds+N2C"          ""    rcds.udp.gatech.edu.
  374.   IN NAPTR 100  50  "s"  "http+N2L+N2C+N2R"  ""    http.tcp.gatech.edu.
  375.  
  376. (Unlike all the other example records in this draft, the one above
  377. is the contents of a zone file, not the response received by the
  378. client. That is so that the wildcard can be seen.)
  379.  
  380. Continuing with our example, we note that the values of the order and
  381. preference fields are equal in all records, so the client is free to
  382. pick any record. The flags field tells us that these are the last NAPTR
  383. patterns we should see, and after the rewrite (a simple replacement in
  384. this case) we should look up SRV records to get information on the
  385. hosts that can provide the necessary service.
  386.  
  387. Assuming we prefer the Z39.50 protocol, our lookup might return:
  388.  
  389. ;;                        Pref Weight   Port Target
  390. z3950.tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu
  391.                      IN SRV 0    0      1000 z3950.cc.gatech.edu
  392.                      IN SRV 0    0      1000 z3950.uga.edu
  393.  
  394. telling us three hosts that could actually do the resolution, and
  395. giving us the port we should use to talk to their Z39.50 server.
  396.  
  397. Recall that the regular expression used \1 to extract a domain name
  398. from the CID. There is a significant caveat about the use of
  399. backslashes in DNS zone files. DNS treats backslashes as the escape
  400. character so that '.' can be escaped when necessary. This means that
  401. when a regular expression is entered into the zone file, the
  402. backslashes must be escaped by another backslash.  For the case of the
  403. cid.urn.net record above, the regular expression entered into the zone
  404. file should be "/.+@([^@]+)/\\1/i".  When the client code actually
  405. receives the record, the pattern will have been converted to
  406. "/.+@([^@]+)/\1/i".
  407.  
  408.  
  409. Example 3
  410. ---------
  411.  
  412. Even if URN systems were in place now, there would still be a
  413. tremendous number of URLs.  It should be possible to develop a URN
  414. resolution system that can also provide location independence for those
  415. URLs.  This is related to the requirement in [1] to be able to
  416. grandfather in names from other naming systems, such as ISO Formal
  417. Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
  418. etc.
  419.  
  420. The NAPTR RR could also be used for URLs that have already been assigned.
  421. Assume we have the URL for a very popular piece of software that the
  422. publisher wishes to mirror at multiple sites around the world:
  423.  
  424.      http://www.foo.com/software/latest-beta.exe
  425.  
  426. We extract the prefix, "http", and lookup NAPTR records for
  427. http.urn.net. This might return a record of the form
  428.  
  429. http.urn.net IN NAPTR
  430. ;;  order   pref flags service      regexp             replacement
  431.      100     90   ""      ""   "!http://([^/:]+)!\1!i"       .
  432.  
  433.  
  434. This expression returns everything after the first double slash and
  435. before the next slash or colon. (We use the '!' character to delimit the
  436. parts of the substitution expression. Otherwise we would have to use backslashes to escape the forward slashes, and would have a regexp in the zone file that
  437. looked like "/http:\\/\\/([^\\/:]+)/\\1/i".).
  438.  
  439. Applying this pattern to the URL extracts "www.foo.com". Looking up NAPTR
  440. records for that might return:
  441.  
  442. www.foo.com
  443. ;;       order pref flags   service  regexp     replacement
  444.  IN NAPTR 100  100  "s"   "http+L2R"   ""    http.tcp.foo.com
  445.  IN NAPTR 100  100  "s"   "ftp+L2R"    ""    ftp.tcp.foo.com
  446.  
  447. Looking up SRV records for http.tcp.foo.com would return information
  448. on the hosts that foo.com has designated to be its mirror sites. The
  449. client can then pick one for the user. 
  450.  
  451.  
  452. NAPTR RR Format
  453. ===============
  454.  
  455. The format of the NAPTR RR is given below. The DNS type code for
  456. NAPTR is 104 [this is being changed, we believe it will be assigned 35].
  457.  
  458.     Domain TTL Class Order Preference Flags Service Regexp Replacement 
  459.  
  460. where:
  461.  
  462. Domain
  463.        The domain name this resource record refers to.
  464. TTL
  465.        Standard DNS Time To Live field
  466. Class
  467.        Standard DNS meaning
  468. Order
  469.        A 16-bit integer specifying the order in which the NAPTR records
  470.        MUST be processed to ensure correct delegation of portions
  471.        of the namespace over time. Low numbers are processed before
  472.        high numbers, and once a NAPTR is found that "matches" a URN,
  473.        the client MUST NOT consider any NAPTRs with a higher value
  474.        for order.
  475.  
  476. Preference
  477.        A 16-bit integer which specifies the order in which NAPTR records
  478.        with equal "order" values SHOULD be processed, low numbers
  479.        being processed before high numbers.  This is similar to the
  480.        preference field in an MX record, and is used so domain
  481.        administrators can direct clients towards more capable hosts
  482.        or lighter weight protocols. 
  483.  
  484. Flags
  485.        A String giving flags to control aspects of the rewriting and
  486.        interpretation of the fields in the record. Flags are single
  487.        characters from the set [A-Z0-9]. The case of the alphabetic
  488.        characters is not significant.
  489.  
  490.        At this time only three flags, "S", "A", and "P", are defined. "S"
  491.        means that the next lookup should be for SRV records instead of NAPTR
  492.        records. "A" means that the next lookup should be for A records. The
  493.        "P" flag says that the remainder of the resolution shall be carried
  494.        out in a Protocol-specific fashion, and we should not do any more
  495.        DNS queries.
  496.        
  497.        The remaining alphabetic flags are reserved. The numeric flags may be
  498.        used for local experimentation. The S, A, and P flags are all mutually
  499.        exclusive, and resolution libraries MAY signal an error if more
  500.        than one is given. (Experimental code and code for assisting in the
  501.        creation of NAPTRs would be more likely to signal such an error than
  502.        a client such as a browser). We anticipate that multiple flags will
  503.        be allowed in the future, so implementers MUST NOT assume that the
  504.        flags field can only contain 0 or 1 characters. Finally, if a client
  505.        encounters a record with an unknown flag, it MUST ignore it and move
  506.        to the next record. This test takes precedence even over the "order"
  507.        field. Since flags can control the interpretation placed on fields,
  508.        a novel flag might change the interpretation of the regexp and/or
  509.        replacement fields such that it is impossible to determine if a
  510.        record matched a URN.
  511.  
  512. Service 
  513.        Specifies the resolution service(s) available down this rewrite
  514.        path. It may also specify the particular protocol that is used to
  515.        talk with a resolver. A protocol MUST be specified if the flags field
  516.        states that the NAPTR is terminal. If a protocol is specified, but
  517.        the flags field does not state that the NAPTR is terminal, the next
  518.        lookup MUST be for a NAPTR. The client MAY choose not to perform
  519.        the next lookup if the protocol is unknown, but that behavior MUST NOT
  520.        be relied upon.
  521.     
  522.        The service field may take any of the values below (using the
  523.        Augmented BNF of RFC 822[8]):
  524.  
  525.            service_field = [ [protocol] *("+" rs)]
  526.            protocol      = "rcds" / "http" / "hdl" / "rwhois"
  527.            rs            = "N2L" / "N2Ls" / "N2R" / "N2Rs" / "N2C"
  528.                          / "N2Ns" / "L2R" / "L2Ns" / "L2Ls" / "L2C"
  529.  
  530.        i.e. an optional protocol specification followed by 0 or more
  531.        resolution services. Each resolution service is indicated by
  532.        an initial '+' character.
  533.  
  534.        Note that the empty string is also a valid service field. This
  535.        will typically be seen at the top levels of a namespace, when it
  536.        is impossible to know what services and protocols will be offered
  537.        by a particular publisher within that name space.
  538.  
  539.        At this time the known protocols are rcds[6], hdl[9] (binary,
  540.        UDP-based protocols),  http[4] (a textual, TCP-based protocol), and
  541.        rwhois[10] (textual, UDP or TCP based). More will be allowed later.
  542.        The names of the protocols must be formed from the characters [a-Z0-9].
  543.        Case of the characters is not significant.
  544.  
  545.        The service requests currently allowed will be described in more
  546.        detail in [5], but in brief they are:
  547.              N2L  - Given a URN, return a URL
  548.              N2Ls - Given a URN, return a set of URLs
  549.              N2R  - Given a URN, return an instance of the resource.
  550.              N2Rs - Given a URN, return multiple instances of the resouce,
  551.                     typically encoded using multipart/alternative.
  552.              N2C  - Given a URN, return a collection of meta-information on
  553.                     the named resource. The format of this response is the
  554.                     subject of another document.
  555.              N2Ns - Given a URN, return all URNs that are also identifers
  556.                     for the resource.
  557.              L2R  - Given a URL, return the resource.
  558.              L2Ns - Given a URL, return all the URNs that are identifiers for
  559.                     the resource.
  560.              L2Ls - Given a URL, return all the URLs for instances of
  561.                     of the same resource.
  562.              L2C  - Given a URL, return a description of the resource.
  563.  
  564.        The actual format of the service request and response will be
  565.        determined by the resolution protocol, and is the subject for other
  566.        documents (e.g. [4]). Protocols need not offer all services. The labels
  567.        for service requests shall be formed from the set of
  568.        characters [A-Z0-9]. The case of the alphabetic characters is
  569.        not significant.
  570.  
  571. Regexp
  572.        A STRING containing a substitution expression that is applied to the
  573.        original URI in order to construct the next name to lookup. The grammar
  574.        of the substitution expression is given in the next section.
  575.  
  576. Replacement
  577.        The next NAME to query for NAPTR, SRV, or A records depending on
  578.        the value of the flags field. As mentioned above, this may be
  579.        compressed.
  580.  
  581.  
  582.  
  583. Substitution Expression Grammar:
  584. ================================
  585.  
  586. The content of the regexp field is a substitution expression. True sed(1)
  587. substitution expressions are not appropriate for use in this application for a
  588. variety of reasons, therefore the contents of the regexp field MUST follow the
  589. grammar below:
  590.  
  591.   subst_expr   = delim-char  ere  delim-char  repl  delim-char  *flags
  592.   delim-char   = "/" / "!" / ... (Any non-digit or non-flag character other
  593.                  than backslash '\'. All occurances of a delim_char in a
  594.                  subst_expr must be the same character.)
  595.   ere          = POSIX Extended Regular Expression (see [11], section 2.8.4)
  596.   repl         = dns_str /  backref / repl dns_str  / repl backref
  597.   dns_str      = ...... which RFC can I cite for this? 1035 seems obsolete .....
  598.   backref      = "\" 1POS_DIGIT
  599.   flags        = "i" 
  600.   DNS_CHAR     = "_" / "0" / "1" / ... / "9" / "a" / ... / "z"
  601.   POS_DIGIT    = "1" / "2" / ... / "9"  ; 0 is not an allowed backref value
  602.  
  603. The result of applying the substitution expression to the original URI shall
  604. be a legal domain name. Since it is possible for the regexp field to be
  605. improperly specified, such that a non-conforming domain name can be
  606. constructed, client software SHOULD verify that the result is a legal
  607. domain name before making queries on it. 
  608.  
  609. Backref expressions in the repl portion of the substitution expression
  610. are replaced by the (possibly empty) string of characters enclosed by '('
  611. and ')' in the ERE portion of the substitution expression. N is a single
  612. digit from 1 through 9, inclusive. It specifies the N'th backref expression,
  613. the one that begins with the N'th '(' and continues to the matching ')'.
  614. For example, the ERE
  615.                    (A(B(C)DE)(F)G)
  616. has backref expressions:
  617.                     \1  = ABCDEFG
  618.                     \2  = BCDE
  619.                     \3  = C
  620.                     \4  = F
  621.                 \5..\9  = error - no matching subexpression
  622.                  
  623. The "i" flag indicates that the ERE matching SHALL be performed in a
  624. case-insensitive fashion. Furthermore, any backref replacements MAY be
  625. normalized to lower case when the "i" flag is given.
  626.  
  627. The first character in the substitution expression shall be used as the
  628. character that delimits the components of the substitution expression.
  629. There must be exactly three non-escaped occurrences of the delimiter
  630. character in a substitution expression. Since escaped occurrences of
  631. the delimiter character will be interpreted as occurrences of that
  632. character, digits MUST NOT be used as delimiters. Backrefs would be
  633. confused with literal digits were this allowed. Similarly, if flags are
  634. specified in the substitution expression, the delimiter character must not
  635. also be a flag character. 
  636.  
  637.  
  638. Advice to domain administrators:
  639. ================================
  640.  
  641. Beware of regular expressions. Not only are they a pain to get
  642. correct on their own, but there is the previously mentioned interaction
  643. with DNS. Any backslashes in a regexp must be entered twice in a zone
  644. file in order to appear once in a query response. More seriously, the
  645. need for double backslashes has probably not been tested by all
  646. implementors of DNS servers. We anticipate that urn.net will be the
  647. heaviest user of regexps. Only when delegating portions of namespaces
  648. should the typical domain administrator need to use regexps.
  649.  
  650. On a related note, beware of interactions with the shell when manipulating
  651. regexps from the command line. Since '\' is a common escape character in
  652. shells, there is a good chance that when you think you are saying "\\" you
  653. are actually saying "\".  Similar caveats apply to characters such as
  654. '*', '(', etc.
  655.  
  656. The "a" flag allows the next lookup to be for A records rather than
  657. SRV records. Since there is no place for a port specification in the
  658. NAPTR record, when the "A" flag is used the specified protocol must
  659. be running on its default port. 
  660.  
  661. The URN-WG is discussing the use of international characters in URNs.
  662. Regular expressions for strings in international character sets are likely
  663. to be essentially impossible to read or write by hand.
  664.  
  665.  
  666. Usage
  667. =====
  668.  
  669. For the edification of implementers, pseudocode for a client routine using NAPTRs is given below. This code is provided merely as a convience, it does
  670. not have any weight as a standard way to process NAPTR records. Also, as is
  671. the case with pseudocode, it has never been executed and may contain logical
  672. errors. You have been warned.
  673.  
  674.     //
  675.     // findResolver(URN)
  676.     // Given a URN, find a host that can resolve it.
  677.     // 
  678.     findResolver(string URN) {
  679.       sprintf(key, "%s.urn.net", extractNS(URN));  // prepend prefix to urn.net
  680.       do {
  681.         rewrite_flag = false;
  682.         terminal = false;
  683.     if (key has been seen) {
  684.       quit with a loop detected error
  685.     }
  686.     add key to list of "seens"
  687.     records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'
  688.  
  689.         sort NAPTR records by "order" field and "preference" field
  690.             (with "order" being more significant than "preference").
  691.         n_naptrs = number of NAPTR records in response.
  692.         curr_order = records[0].order;
  693.         max_order = records[n_naptrs-1].order;
  694.         
  695.         // Process current batch of NAPTRs according to "order" field.
  696.         for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
  697.           if (unknown-flag) // skip this record and go to next one
  698.              continue; 
  699.           newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
  700.           if (!newkey) // Skip to next record if the rewrite didn't match
  701.              continue;  
  702.           // We did do a rewrite, shrink max_order to current value
  703.           // so that delegation works properly
  704.           max_order = naptr[j].order;
  705.           // Will we know what to do with the protocol and services
  706.           // specified in the NAPTR? If not, try next record.
  707.           if(!isKnownProto(naptr[j].services)) {
  708.             continue;
  709.           }
  710.           if(!isKnownService(naptr[j].services)) {
  711.             continue;
  712.           }
  713.  
  714.           // At this point we have a successful rewrite and we will know
  715.           // how to speak the protocol and request a known resolution
  716.           // service. Before we do the next lookup, check some
  717.           // optimization possibilities.
  718.           
  719.           if (strcasecmp(flags, "S")
  720.            || strcasecmp(flags, "P"))
  721.            || strcasecmp(flags, "A")) {
  722.              terminal = true;
  723.              services = naptr[j].services;
  724.              addnl = any SRV and/or A records returned as additional info
  725.                      for naptr[j].
  726.           }
  727.           key = newkey;
  728.           rewriteflag = true;
  729.           break;
  730.         }
  731.       } while (rewriteflag && !terminal);
  732.  
  733.       // Did we not find our way to a resolver?
  734.       if (!rewrite_flag) {
  735.          report an error
  736.          return NULL;
  737.       }
  738.  
  739.  
  740.       // Leave rest to another protocol?
  741.       if (strcasecmp(flags, "P")) {
  742.          return key as host to talk to;
  743.       }
  744.  
  745.       // If not, keep plugging
  746.       if (!addnl) { // No SRVs came in as additional info, look them up
  747.         srvs = lookup(type=SRV, key);
  748.       }  
  749.  
  750.       sort SRV records by preference, weight, ...
  751.       foreach (SRV record) { // in order of preference
  752.         try contacting srv[j].target using the protocol and one of the
  753.             resolution service requests from the "services" field of the
  754.             last NAPTR record.
  755.         if (successful)
  756.           return (target, protocol, service);
  757.           // Actually we would probably return a result, but this
  758.           // code was supposed to just tell us a good host to talk to.
  759.       }
  760.       die with an "unable to find a host" error;
  761.     }
  762.  
  763.  
  764. Notes:
  765. ======
  766.   -  A client MUST process multiple NAPTR records in the order specified by
  767.      the "order" field, it MUST NOT simply use the first record that provides
  768.      a known protocol and service combination.
  769.   -  If a record at a particular order matches the URI, but the client
  770.      doesn't know the specified protocol and service, the client SHOULD
  771.      continue to examine records that have the same order. The client
  772.      MUST NOT consider records with a higher value of order. This is
  773.      necessary to make delegation of portions of the namespace work.
  774.      The order field is what lets site administrators say "all requests for
  775.      URIs matching pattern x go to server 1, all others go to server 2".
  776.      (A match is defined as:
  777. 1)  The NAPTR provides a replacement domain name
  778.         or
  779.         2) The regular expression matches the URN
  780.      )
  781.   -  When multiple RRs have the same "order", the client should use
  782.      the value of the preference field to select the next NAPTR to
  783.      consider. However, because of preferred protocols or services,
  784.      estimates of network distance and bandwidth, etc. clients
  785.      may use different criteria to sort the records.
  786.   -  If the lookup after a rewrite fails, clients are strongly encouraged
  787.      to report a failure, rather than backing up to pursue other rewrite
  788.      paths.
  789.   -  When a namespace is to be delegated among a set of resolvers, regexps
  790.      must be used. Each regexp appears in a separate NAPTR RR. Administrators
  791.      should do as little delegation as possible, because of limitations on
  792.      the size of DNS responses.
  793.   -  Note that SRV RRs impose additional requirements on clients.
  794.  
  795.  
  796. Acknowledgments:
  797. =================
  798.  
  799. The authors would like to thank Keith Moore for all his consultations
  800. during the development of this draft. We would also like to thank Paul
  801. Vixie for his assistance in debugging our implementation, and his answers
  802. on our questions.
  803.  
  804.  
  805. References:
  806. ===========
  807.  
  808. [1] RFC-1737, "Functional Requirements for Uniform Resource Names", Karen
  809.     Sollins and Larry Masinter, Dec. 1994.
  810.  
  811. [2] Urn implementors article in DLIB?
  812. Perhaps
  813. [2] draft-daigle-urn-framework-00.txt "A Uniform Resource Naming
  814.     Framework", Leslie Daigle and Patrik Faltstrom, June, 1996.
  815.  
  816.  
  817. [3] RFC 2052, "A DNS RR for specifying the location of services (DNS SRV)",
  818.     A. Gulbrandsen and P. Vixie, October 1996.
  819.  
  820. [4] RFC-xxxx, "Conventions for the Use of HTTP for Resolution of URNs",
  821.     Ron Daniel Jr., currently available as draft-ietf-urn-http-conv-01.txt,
  822.     Dec. 1996.
  823.  
  824. [5] RFC-xxxx, "URN Resolution Services", ???, draft-ietf-urn-???
  825.     (This document is on the URN-WG's list of documents to prepare, but
  826.     has not yet been written. It will get its start from the treatment of
  827.     resolution services in [4]).
  828.  
  829. [6] Keith Moore, "Resource Cataloging and Distribution Service", ???
  830.  
  831. [7] Paul Vixie, personal communication.
  832.  
  833. [8] RFC-822, "Standard for the Format of ARPA Internet Text Messages",
  834.     Dave H. Crocker, August 1982.  
  835.  
  836. [9] Charles Orth, Bill Arms; Handle Resolution Protocol Specification,
  837.     http://www.handle.net/docs/client_spec.html
  838.  
  839. [10] RFC-1714, "Referral Whois Protocol (RWhois)", S. Williamson and
  840.      M. Kosters, November 1994.
  841.  
  842. [11] IEEE Standard for Information Technology - Portable Operating System
  843.     Interface (POSIX) - Part 2: Shell and Utilities (Vol. 1); IEEE Std
  844.     1003.2-1992; The Institute of Electrical and Electronics Engineers;
  845.     New York; 1993. ISBN:1-55937-255-9
  846.  
  847.  
  848.  
  849.  
  850. Security Considerations
  851. =======================
  852.   The use of "urn.net" as the registry for URN namespaces is subject to
  853.   denial of service attacks, as well as other DNS spoofing attacks. The
  854.   interactions with DNSSEC are currently being studied. It is expected
  855.   that NAPTR records will be signed with SIG records once the DNSSEC
  856.   work is deployed. 
  857.  
  858.   The rewrite rules make identifiers from other namespaces subject to
  859.   the same attacks as normal domain names. Since they have not been
  860.   easily resolvable before, this may or may not be considered a problem.
  861.  
  862.   Regular expressions should be checked for sanity, not blindly passed
  863.   to something like PERL. 
  864.  
  865. Author Contact Information:
  866. ===========================
  867.  
  868. Ron Daniel
  869. Los Alamos National Laboratory
  870. MS B287
  871. Los Alamos, NM, USA, 87545
  872. voice:  +1 505 665 0597
  873. fax:    +1 505 665 4939
  874. email:  rdaniel@lanl.gov
  875.  
  876.  
  877. Michael Mealling
  878. Network Solutions
  879. 505 Huntmar Park Drive
  880. Herndon, VA  22070
  881. voice: (703) 742-0400
  882. fax: (703) 742-9552
  883. email: michaelm@internic.net
  884. URL: http://www.netsol.com/
  885.  
  886.  
  887.  
  888.  
  889.     This draft expires 14 July, 1997.
  890.  
  891.  
  892. Ron Daniel Jr.                       email: rdaniel@lanl.gov
  893. Advanced Computing Lab,  MS B287     voice: +1 505 665 0597
  894. Los Alamos National Laboratory         fax: +1 505 665 4939
  895. Los Alamos, NM, USA  87545            http://www.acl.lanl.gov/~rdaniel/
  896.  Want to buy: "The Five Laws of Library Science" by S.R. Ranganathan